import 'package:flutter_common_fragement/common/base/shared_preference/shared_preference.dart';
import 'package:flutter_common_fragement/common/config/index.dart';

mixin SharedPreferenceMixin {
  /// 清除所有sp缓存
  Future<void> clearAll() async {
    await SpUtil.clear();
    return;
  }

  /// 是否第一次进入app
  Future<void> storageIsFirstOpen() async {
    await SpUtil.putString(Constant.isFirstOpen, "1");
  }

  /// 获取 isFirstOpen 数据
  String getIsFirstOpenFromStorage() {
    return SpUtil.getString(Constant.isFirstOpen, defValue: "0") ?? "0";
  }
}
